package edu.byu.intex2.data;

import edu.byu.intex2.data.bo.*;
import magis.ServiceController;

/**
 * Stores active variables across multiple states of the application
 * @author Brady
 */
public class Model {

    private Employee employee = null;
    private Customer customer = null;
    private Sale sale = null;

    public static final double HOURLY_RATE = 90;
    public static final double TAX_RATE = 0.0625;

    /////////////////////////////////////////////
    ///   Singleton code
    private static Model instance = null;

    /** Creates a new instance of EmployeeDAO */
    private Model() {
    }//constructor

    /** Retrieves the single instance of this class */
    public static synchronized Model getInstance() {
        if (instance == null) {
            instance = new Model();
        }
        return instance;
    }//getInstance

    /**
     * @return the employee
     */
    public Employee getEmployee() {
        return employee;
    }

    /**
     * @param employee the employee to set
     */
    public void setEmployee(Employee employee) {
        this.employee = employee;
    }

    /**
     * @return the customer
     */
    public Customer getCustomer() {
        return customer;
    }

    /**
     * @param customer the customer to set
     */
    public void setCustomer(Customer customer) {
        this.customer = customer;
    }

    /**
     * @return the sale
     */
    public Sale getSale() {
        return sale;
    }

    /**
     * @param sale the sale to set
     */
    public void setSale(Sale sale) {
        this.sale = sale;
    }

    /**
     * @return the service
     */
    public Service getService() {
        return ServiceController.getInstance().getService();
    }

    /**
     * @param service the service to set
     */
    public void setService(Service service) {
       ServiceController.getInstance().setService(service);
    }
}
